package com.galengao.springboot.excel.event;

import com.alibaba.excel.context.AnalysisContext;
import com.alibaba.excel.event.AnalysisEventListener;
import com.alibaba.excel.metadata.data.ReadCellData;
import com.galengao.springboot.excel.enrity.UserDto;

import java.util.Map;

/**
 * 读取excel监听器
 *
 * @author GalenGao
 * @version Id: ExcelListener.java, v 0.1 2022/6/5 16:53 GalenGao Exp $$
 */
public class ExcelListener extends AnalysisEventListener<UserDto> {

    @Override
    public void invokeHeadMap(Map<Integer, String> headMap, AnalysisContext context) {
        System.out.println("表头信息2："+headMap);
    }

    /**
     * 一行行执行的动作
     * @param userDto
     * @param analysisContext
     */
    @Override
    public void invoke(UserDto userDto, AnalysisContext analysisContext) {
        System.out.println("读取数据："+userDto);
    }

    /**
     * excel 读取完毕后支线的动作
     * @param analysisContext
     */
    @Override
    public void doAfterAllAnalysed(AnalysisContext analysisContext) {

    }
}
